public class Fighter {
	public String name;// 战斗机的名称
	public double health;// 生命值
	private Long lastFireTime;// 上一次发射的时间

	public Fighter(String name, double health) {
		this.name = name;
		this.health = health;
		lastFireTime = (long) 0;
	}
	public void hit(double damage) {
		this.health -= damage;
		if (this.health < 0)
			this.health = 0;
	}
	public void fire(Fighter enimyFighter) {
		if (System.currentTimeMillis() - lastFireTime > 1000) {
			if (this.health > 0) {
				enimyFighter.hit(Math.random() * 10);
				lastFireTime = System.currentTimeMillis();// 精确到毫秒
			}
		}
	}
	public boolean isDestroyed() {
		if (health > 0)
			return (false);
		else
			return (true);
	}
	public void info() {
		System.out.printf("战斗机(%s)还剩下%f生命值\n", this.name, this.health);
	}
}
